//
//  CreateAdvertisingFormSwiftViewController.swift
//  iModern
//
//  Created by 立雄 王 on 15/6/26.
//  Copyright (c) 2015年 com.starlooking. All rights reserved.
//

import UIKit
import XLForm

class IndexOfSaleTagsViewController: FormViewController
{
    var adver                               = NSMutableDictionary()
    var createAdvertisingFormViewController = CreateAdvertisingFormViewController()

    override func viewDidLoad()
    {
        super.viewDidLoad()

        self.navigationItem.title = "选择分类"
        self.initBackButton()
        let image  = UIImage(named: "Save-Small.png")
        let button = UIBarButtonItem(image: image?.imageWithRenderingMode(.AlwaysOriginal), style: .Plain, target: self, action: "IndexOfSaleTagsViewController:")
        self.navigationItem.rightBarButtonItem = button

        self.initializeForm()

        // Do any additional setup after loading the view.
    }

    func initializeForm()
    {
        var form:    XLFormDescriptor
        var section: XLFormSectionDescriptor
        var row:     XLFormRowDescriptor

        form = XLFormDescriptor(title: " ")

        section = XLFormSectionDescriptor.formSectionWithTitle("根据你要发布的宝贝，选择分类")
        section.footerTitle = " "
        form.addFormSection(section)

        row = XLFormRowDescriptor(tag: "a", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     形象管理")
        let a = ["服装", "珠宝", "鞋子", "箱包"]
        row.selectorOptions = a
        section.addFormRow(row)

        row = XLFormRowDescriptor(tag: "b", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     创意酷玩")
        let c = ["绘画", "皮艺", "纸艺", "陶艺", "女红", "纹身", "玩具", "乐器"]
        row.selectorOptions = c
        section.addFormRow(row)

        row = XLFormRowDescriptor(tag: "c", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     修养提升")
        let d = ["乐器", "茶艺", "陶艺", "文玩", "绘画", ]
        row.selectorOptions = d
        section.addFormRow(row)

        row = XLFormRowDescriptor(tag: "d", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     梦想之家")
        let e = ["家具", "装修", "园艺", "女红", "修理"]
        row.selectorOptions = e
        section.addFormRow(row)

        row = XLFormRowDescriptor(tag: "e", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     品味生活")
        let f = ["美食", "布艺", "美妆", "健康", "茶艺", "酒水", "纹身"]
        row.selectorOptions = f
        section.addFormRow(row)

        row = XLFormRowDescriptor(tag: "f", rowType: XLFormRowDescriptorTypeSelectorPush, title: "icon     科技怪诞")
        let b = ["电子科技"]
        row.selectorOptions = b
        section.addFormRow(row)

        self.form = form

    }

    @IBAction func IndexOfSaleTagsViewController(sender: AnyObject)
    {
        let a = self.formValues()["a"] as? String
        if a == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["a"]
        }
        let b = self.formValues()["b"] as? String
        if b == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["b"]
        }
        let c = self.formValues()["c"] as? String
        if c == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["c"]
        }
        let d = self.formValues()["d"] as? String
        if d == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["d"]
        }
        let e = self.formValues()["e"] as? String
        if e == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["e"]
        }
        let f = self.formValues()["f"] as? String
        if f == nil
        {
        }
        else
        {
            adver["indexOfSaleTags"] = self.formValues()["f"]
        }
        self.navigationController?.popViewControllerAnimated(true)
    }

    override func didReceiveMemoryWarning()
    {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    /*
    // MARK: - Navigation
    
    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
    }
    */

}
